package com.xjm.ips.service;

import com.xjm.ips.entity.MenuRole;
import com.xjm.ips.mapper.MenuRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class MenuRoleService {
    @Autowired
    MenuRoleMapper menuRoleMapper;

    @Transactional
    public boolean updateMenuRoLe(Integer rid, Integer[] menuIds) {
        menuRoleMapper.deleteByRoleId(rid);
        if(menuIds == null || menuIds.length==0){
            return true;
        }
        Integer result =  menuRoleMapper.insertRecord(rid,menuIds);
        return result == menuIds.length;
    }
}
